var e = function(e) {
    return e && e.__esModule ? e : {
      default: e
    };
  }(require("../devops/raven/raven")),
  t = "https://lite.italki.cn/api/",
  n = function(t, n) {
    wx.showToast({
      title: "加载中",
      icon: "loading"
    });
    var s = {
      hl: "zh-cn"
    };
    try {
      var i = wx.getStorageSync("token");
      i ? Object.assign(s, t.data, {
        i_token: i
      }) : Object.assign(s, t.data);
    } catch (e) {
      Object.assign(s, t.data);
    }
    wx.request({
      url: n,
      method: t.method || "GET",
      data: s,
      header: {
        "content-type": "application/x-www-form-urlencoded",
        "X-Device": 9
      },
      success: function(s) {
        e.default.captureBreadcrumb({
          category: "ajax",
          data: {
            method: "get",
            url: n,
            status_code: 200
          }
        }), t.success && t.success(s), 417 === s.statusCode && wx.clearStorage(), wx.hideToast();
      },
      fail: function(e) {
        t.fail && t.fail(e), wx.showToast({
          title: e.errMsg,
          icon: "none"
        });
      },
      complete: function(e) {
        t.complete && t.complete(e);
      }
    });
  };

module.exports = {
  getCurrency: function(e) {
    return n(e, t + "finance/currency");
  },
  resetPassword: function(e) {
    return n(e, t + "account/reset");
  },
  getCaptchaViaPhone: function(e) {
    return n(e, t + "captcha/cellphone");
  },
  signViaPhone: function(e) {
    return n(e, t + "account/login/wechatandphone");
  },
  signViaEmail: function(e) {
    return n(e, t + "account/login/wechatandemail");
  },
  loginViaToken: function(e) {
    return n(e, t + "login");
  },
  loginViaWechat: function(e) {
    return n(e, t + "account/login/wechat");
  },
  getUserStatistics: function(e) {
    return n(e, t + "account/statistics?embed=revenue_account,finished_lesson_count,current_month_finished_lesson_count,payment_account");
  },
  getUserImAccount: function(e) {
    return n(e, t + "account/im-account");
  },
  getChildTags: function(e) {
    return n(e, t + "teacher/child-tags");
  },
  getTeachersList: function(e) {
    return n(e, t + "teachersv2");
  },
  getTeacherProfileById: function(e) {
    return n(e, t + "teacher/" + e.query.id);
  },
  getTeacherPersonalTagById: function(e) {
    return n(e, t + "teacher/personaltag");
  },
  getCourseListByTeacherId: function(e) {
    return n(e, t + "teacher/" + e.query.id + "/course");
  },
  getLatestSessions: function(e) {
    return n(e, t + "teacher/" + e.query.id + "/latest-sessionlist");
  },
  getTeacherAvailableTime: function(e) {
    var x = n(e, t + "teacher/" + e.query.id + "/available/cn");
    console.log(t + "teacher/" + e.query.id + "/available/cn");
    return x;
  },
  getTeacherReviews: function(e) {
    return n(e, t + "teacher/" + e.query.id + "/sessionlist-by-teacher-with-student");
  },
  sessionRequest: function(e) {
    return n(e, t + "session/request?i_token=" + e.token);
  },
  sessionPackageRequest: function(e) {
    return n(e, t + "session/package/request?i_token=" + e.token);
  },
  sessionTrialRequest: function(e) {
    return n(e, t + "session/request-trial?i_token=" + e.token);
  },
  packageAddSession: function(e) {
    return n(e, t + "session/package/" + e.package_id + "/add-sessions?i_token=" + e.token);
  },
  sessionDetail: function(e) {
    return n(e, t + "session/" + e.session_id + "?i_token=" + e.token);
  },
  sessionPackageDetail: function(e) {
    return n(e, t + "session/package/" + e.package_id + "?i_token=" + e.token);
  },
  sessionProblemDetail: function(e) {
    return n(e, t + "session/problem/" + e.session_id);
  },
  getMessage: function(e) {
    return n(e, t + "session/" + e.session_type + e.session_id + "/messages?i_token=" + e.token);
  },
  sendMessage: function(e) {
    return n(e, t + "session/" + e.session_type + e.session_id + "/messages?i_token=" + e.token);
  },
  teacherFeedback: function(e) {
    return n(e, t + "teacher/feedback/tag?i_token=" + e.token + "&session_id=" + e.session_id);
  },
  sessionOperateHistory: function(e) {
    return n(e, t + "session/" + e.session_id + "/history?i_token=" + e.token);
  },
  wechatPurchase: function(e) {
    return n(e, t + "payment");
  },
  wechatPayment: function(e) {
    return n(e, t + "payment?i_token=" + e.token);
  },
  unpayCheck: function(e) {
    return n(e, t + "session/unpay_check?unpay_id=" + e.unpay_id);
  },
  sessionList: function(e) {
    return n(e, t + "student/session");
  },
  sessionPackageList: function(e) {
    return n(e, t + "student/package");
  },
  financeHistoryList: function(e) {
    return n(e, t + "finance/payment/history");
  },
  redeemGiftCard: function(e) {
    return n(e, t + "voucher/activate");
  },
  couponList: function(e) {
    return n(e, t + "voucher/spec");
  },
  getReferralHistory: function(e) {
    return n(e, t + "account/referral/history");
  },
  getReferralDecrypto: function(e) {
    return n(e, t + "account/referral/decrypto");
  },
  messageList: function(e) {
    return n(e, t + "message");
  },
  messageWithUser: function(e) {
    return n(e, t + "message/with/" + e.user_id);
  }
};